import { BasicColumn, FormSchema } from '/@/components/Table';
import moment from 'moment';

export const columns: BasicColumn[] = [
  {
    title: '编号',
    dataIndex: 'id',
    width: 100,
  },
  {
    title: '表单名',
    dataIndex: 'name',
    width: 180,
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 180,
    customRender: ({ text }) => {
      switch (text) {
        case 0:
          return '启用';
          break;
        case 1:
          return '禁用';
          break;
      }
    },
  },
  {
    title: '备注',
    dataIndex: 'remark',
    width: 180,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 180,
    customRender: ({ record }) => {
      const time = record.createTime;
      return time ? moment(time).format('YYYY-MM-DD HH:mm:ss') : '-';
    },
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '表单名',
    field: 'name',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: ({ tableAction }) => {
      return {
        onPressEnter: () => {
          const { reload } = tableAction;
          reload();
        },
      };
    },
  },
  // {
  //   label: '状态',
  //   field: 'status',
  //   component: 'Select',
  //   // componentProps: {
  //   //   options: getDictOptions(DICT_TYPE.COMMON_STATUS),
  //   // },
  //   colProps: { span: 8 },
  // },
];
